Page({
    data: {
        textColorData: 'transparent',
        backgroundData: 'transparent',
        showvisible: false,
        inputText: '',
    },

    onLoad(options) {},
    onShow() {
        this.getUserInfo();
    },
    // 开启页面分享
    onShareAppMessage(e) {
        console.log(e);
    },
    onOpenTeam() {
        this.setData({
            showvisible: true,
        });
    },

    onVisibleChange() {
        this.setData({
            showvisible: false,
        });
    },

    async onBlur(e) {
        if (e.detail.value.length == 6) {
            this.setData({
                inputText: e.detail.value,
            });
            await this.sleep(200);
            this.request({
                url: 'user/my/team/index',
                method: 'POST',
                loadingTip: '加载中',
                data: {
                    password: this.data.inputText,
                    page: 1,
                    limit: 999,
                },
            })
                .then(res => {
                    wx.navigateTo({
                        url: '/pages/myTeam/myTeam?pwd=' + this.data.inputText,
                    });
                    this.setData({
                        showvisible: false,
                        inputText: '',
                    });
                })
                .catch(err => {
                    this.setData({
                        showvisible: false,
                        inputText: '',
                    });
                });
        }
    },

    onPageScroll(e) {
        console.log();
        if (e.scrollTop > 1) {
            this.setData({
                textColorData: '#ffffff',
                backgroundData: '#F75F51',
            });
        } else {
            this.setData({
                textColorData: 'transparent',
                backgroundData: 'transparent',
            });
        }
    },
});
